package com.empirisoftware.logging.conf;

import org.apache.commons.logging.Log;

import com.empirisoftware.logging.TraceLogger;
import com.empirisoftware.logging.TraceLoggerInterceptor;
import com.google.inject.Binder;
import com.google.inject.Module;
import com.google.inject.Singleton;
import com.google.inject.matcher.Matchers;

public class LoggingModule implements  Module {
	@Override
	public void configure(Binder binder) {
		binder.bind(Log.class).toProvider(LogProvider.class).in(Singleton.class);
		binder.requestStaticInjection(TraceLoggerInterceptor.class);
		binder.bindInterceptor(Matchers.any(),Matchers.annotatedWith(TraceLogger.class),new TraceLoggerInterceptor());
	}
}